 package student.stu23002108.chapter10;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class demo1 {
    public static void main(String[] args) {
        File f = new File("C:\\Users\\xiaoyu\\IdeaProjects\\java202312\\src\\student\\stu23002108\\chapter10\\stu23002108.txt");
        // 创建文件并写入内容C:\Users\xiaoyu\IdeaProjects\java202312\src\student\stu23002108

        try {

            FileWriter writer1 = new FileWriter(f);
            writer1.write("stu23002108");
            writer1.close();

            System.out.println("Files created: " + f.getAbsolutePath() + " and " + f.getAbsolutePath());
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println(f);
    }

    }